Skip to contentSkip to conversation

rbd: print a clear error message when write beyond EOF

PATCH In review Jun Li 3 participants 5 messages Dec 11, 2014 Block layer

lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH v2 1/1 rbd: print a clear error message when write beyond EOF

Currently, as rbd driver do not support dynamic growth when write beyond EOF, so just print a clear error message.

---
v2:
Just use rbd_aio_write to realize error detection.

---
 block/rbd.c | 4 ++++
 1 file changed, 4 insertions(+)
block/rbd.c +4 -0
index 5b5a64a..710ee3e 100644
@@ -661,6 +661,10 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
     }
 
     if (r < 0) {
+        if (r == -EINVAL && cmd == RBD_AIO_WRITE) {
+            fprintf(stderr, "Image formats that grow on demand "
+                            "are not supported on rbd.\n");
+        }
         goto failed_completion;
     }
 
Signature · 1 line
1.9.3
#1 lore raw

Am 11.12.2014 um 07:25 hat Jun Li geschrieben:

Quoted 16 lines

Currently, as rbd driver do not support dynamic growth when write beyond EOF, so just print a clear error message.

---
v2:
Just use rbd_aio_write to realize error detection.

---
 block/rbd.c | 4 ++++
 1 file changed, 4 insertions(+)
block/rbd.c +0 -0
index 5b5a64a..710ee3e 100644

block/rbd.c static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, · line 669

Quoted 9 lines
block/rbd.c +4 -0
@@ -661,6 +661,10 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
     }
 
     if (r < 0) {
+        if (r == -EINVAL && cmd == RBD_AIO_WRITE) {
+            fprintf(stderr, "Image formats that grow on demand "
+                            "are not supported on rbd.\n");
+        }
         goto failed_completion;
     }

You can't fill up the log with messages like that. In general, if you use fprintf() in a function whose call can be triggered by the guest, you're doing it wrong.

What needs to be done is to check at open time whether the configuration works. Max has sent a series to that end a while ago, not sure what its status is. I think it ended up depending on some blockdev work.

Kevin

#2 lore raw
Quoted 30 lines · Kevin Wolf

Am 11.12.2014 um 07:25 hat Jun Li geschrieben:

Quoted 16 lines

Currently, as rbd driver do not support dynamic growth when write beyond EOF, so just print a clear error message.

---
v2:
Just use rbd_aio_write to realize error detection.

---
  block/rbd.c | 4 ++++
  1 file changed, 4 insertions(+)
block/rbd.c +0 -0
index 5b5a64a..710ee3e 100644

block/rbd.c static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, · line 669

Quoted 9 lines
block/rbd.c +4 -0
@@ -661,6 +661,10 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState *bs,
      }
 
      if (r < 0) {
+        if (r == -EINVAL && cmd == RBD_AIO_WRITE) {
+            fprintf(stderr, "Image formats that grow on demand "
+                            "are not supported on rbd.\n");
+        }
          goto failed_completion;
      }

You can't fill up the log with messages like that. In general, if you use fprintf() in a function whose call can be triggered by the guest, you're doing it wrong.

Quoted 3 lines

What needs to be done is to check at open time whether the configuration works. Max has sent a series to that end a while ago, not sure what its status is. I think it ended up depending on some blockdev work.

Yes, the status is that we need to remove "growable" from the BDS first.

Max

author
#3 lore raw

Jun Li

Quoted 6 lines · 2014-12-11 下午5:13于 "Max Reitz" <[email protected]>写道:
Quoted 4 lines · Kevin Wolf

Am 11.12.2014 um 07:25 hat Jun Li geschrieben:

Quoted 2 lines

Currently, as rbd driver do not support dynamic growth when write

beyond EOF,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

so just print a clear error message.

---
v2:
Just use rbd_aio_write to realize error detection.

---
  block/rbd.c | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 5 lines
Quoted 5 lines

block/rbd.c static BlockAIOCB *rbd_start_aio(BlockDriverState

Quoted 5 lines
block/rbd.c +0 -0
index 5b5a64a..710ee3e 100644
@@ -661,6 +661,10 @@ static BlockAIOCB *rbd_start_aio(BlockDriverState

*bs,

Quoted 13 lines
Quoted 13 lines

block/rbd.c static BlockAIOCB *rbd_start_aio(BlockDriverState *bs, · line 669

Quoted 8 lines
block/rbd.c +4 -0
      }
        if (r < 0) {
+        if (r == -EINVAL && cmd == RBD_AIO_WRITE) {
+            fprintf(stderr, "Image formats that grow on demand "
+                            "are not supported on rbd.\n");
+        }
          goto failed_completion;
      }

You can't fill up the log with messages like that. In general, if you use fprintf() in a function whose call can be triggered by the guest, you're doing it wrong.

Quoted 7 lines
Quoted 3 lines

What needs to be done is to check at open time whether the configuration works. Max has sent a series to that end a while ago, not sure what its status is. I think it ended up depending on some blockdev work.

Yes, the status is that we need to remove "growable" from the BDS first.

Hi, which serial do you mean? Could you give a link? Thx.

Jun Li

#4 lore raw
Quoted 41 lines · jun muzi

Jun Li

Quoted 6 lines · 2014-12-11 下午5:13于 "Max Reitz" <[email protected] <mailto:[email protected]>>写道:
Quoted 4 lines · Kevin Wolf

Am 11.12.2014 um 07:25 hat Jun Li geschrieben:

Quoted 2 lines

Currently, as rbd driver do not support dynamic growth when write

beyond EOF,

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

so just print a clear error message.

Signed-off-by Jun Li <[email protected] <mailto:[email protected]>>

---
v2:
Just use rbd_aio_write to realize error detection.

---
  block/rbd.c | 4 ++++
  1 file changed, 4 insertions(+)
Quoted 5 lines
Quoted 5 lines

block/rbd.c static BlockAIOCB

Quoted 5 lines
block/rbd.c +0 -0
index 5b5a64a..710ee3e 100644
@@ -661,6 +661,10 @@ static BlockAIOCB 

*rbd_start_aio(BlockDriverState *bs,

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
block/rbd.c +4 -0
      }
        if (r < 0) {
+        if (r == -EINVAL && cmd == RBD_AIO_WRITE) {
+            fprintf(stderr, "Image formats that grow on demand "
+                            "are not supported on rbd.\n");
+        }
          goto failed_completion;
      }
Quoted 5 lines
Quoted 5 lines

You can't fill up the log with messages like that. In general, if you use fprintf() in a function whose call can be triggered by the guest, you're doing it wrong.

What needs to be done is to check at open time whether the

configuration

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

works. Max has sent a series to that end a while ago, not sure what its status is. I think it ended up depending on some blockdev work.

Yes, the status is that we need to remove "growable" from the BDS first.

Hi, which serial do you mean? Could you give a link? Thx.

Hi, here it is: http://lists.nongnu.org/archive/html/qemu-devel/2014-07/msg02088.html

Max